function switchPanel(id){
    var panel01 = document.getElementById("panel01");
    var panel02 = document.getElementById("panel02");
    var panel03 = document.getElementById("panel03");
    
    if(id == "panel01"){
        panel01.style.display = "block";
        panel02.style.display = "none";
        panel03.style.display = "none";        
    }else if(id == "panel02"){
        panel01.style.display = "none";
        panel02.style.display = "block";
        panel03.style.display = "none";
    }else{
        panel01.style.display = "none";
        panel02.style.display = "none";
        panel03.style.display = "block";
    }
}

function editPanel(id){
    var panel01 = document.getElementById("panel01");
    var panel02 = document.getElementById("panel02");
    var panel03 = document.getElementById("panel03");
    
    panel01.style.display = "none";
    panel02.style.display = "none";
    panel03.style.display = "block";
    
    var input_hidden = document.getElementById("hidden_id");
    input_hidden.setAttribute("value", id);
    
    var book = document.getElementsByClassName("book_" + id)[0];
    document.getElementById("book_index").setAttribute("value", book.getElementsByClassName("book_index")[0].innerHTML);
    document.getElementById("title").setAttribute("value", book.getElementsByClassName("title")[0].innerHTML);
    document.getElementById("author").setAttribute("value", book.getElementsByClassName("author")[0].innerHTML);
    document.getElementById("publisher").setAttribute("value", book.getElementsByClassName("publisher")[0].innerHTML);
    document.getElementById("publish_time").setAttribute("value", book.getElementsByClassName("publish_time")[0].innerHTML);
    var option_value = book.getElementsByClassName("category")[0].innerHTML;
    var select = document.getElementById("category");
    var options = select.getElementsByTagName("option");
    for (var i = 0; i < options.length; i++) {
        var elem = options[i];
        elem.setAttribute("selected", "");
    }
    for (var i = 0; i < options.length; i++) {
        var elem = options[i];
        if(elem.getAttribute("value") == option_value){
            elem.setAttribute("selected", "selected");
            break;
        }
    }
    document.getElementById("price").setAttribute("value", book.getElementsByClassName("price")[0].innerHTML);
    
}